home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
17 Bit Software 3: The Continuation
/
17-Bit_The_Continuation_Disc.iso
/
amigan
/
amigan 10
/
menus
/
do_arguments.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-27
|
1KB
|
50 lines
#include "exec/types.h"
extern int Flgs[26];
extern int Enable_Abort; /* Flgs[2] (-c) will set to non zero */
/* to enable checks for abort */
Do_Arguments(count,strings)
int count;
char *strings[];
{
register int loop;
register char *ptr;
int c;
if ( count == 2 && *strings[1] == '?' )
{
printf(" Usage is: %s [-option ... -option]\n",strings[0]);
}
else
{
for(loop=0; loop < 26; loop++) Flgs[loop] = FALSE;
while ( --count > 0 )
{
ptr = *++strings;
if ( *ptr++ == '-' )
{
c = toupper(*ptr) - 'A' ; /* get an index 0 to 25 */
if ( c >= 0 && c <= 25 )
{
Flgs[c] = TRUE;
}
else
{
printf(" %s has an invalid option: %s\n",strings[0],ptr);
};
};
};
};
if( Flgs[3] ) /* if -d requested show selected options */
for ( c = 0; c < 26; c++)
if ( Flgs[c] ) printf(" Option %d is on\n",c);
if( Flgs[2] )
{
Enable_Abort = 0; /* no abort on control-c unless user does it */
}
else
{
Enable_Abort = 1; /* abort on control-c */
};
}